package Basic

object SetAndMapAndIterator {
  def main(args: Array[String]): Unit = {
    //    //不可变
    //    var mySet = Set("Hadoop","Spark")
    //    mySet+="Spark"
    //    println(mySet)
    //    //可变
    //    import scala.collection.mutable.Set
    //    val myMutableSet = Set("Big","Data")
    //    myMutableSet+="Set"
    //    println(myMutableSet)
    //    val map = Map("name" -> "张三", "id" -> "1", "age" -> "20")
    //    println(map("name"))
    //
    //    //为了给定的键不存在而报错，可以这样
    //    val name = if (map.contains("name")) map("name") else 0;println(name)
    val iter = Iterator("Hadoop","Spark","Scala")
    while (iter.hasNext) {
      println(iter.next())
    }
  }
}
